#pragma once
#include<iostream>
#include<vector>
#include<ctime>
#include<cstdlib>


typedef void (*task)();

void TaskPrint()
{
	std::cout<< "我是一个打印的任务" << std::endl; 
}

void TaskDownload()
{
	std::cout<< "我是一个下载的任务" << std::endl;
}

void TaskUpload()
{
	std::cout<<"我是一个上传的任务" <<std::endl;
}

class Task
{
public:
	Task()
	{
		srand((unsigned int)time(nullptr));
		_vtask.emplace_back(TaskPrint);
		_vtask.emplace_back(TaskDownload);
		_vtask.emplace_back(TaskUpload);
	}
 
	~Task()
	{
		
	}

	int MakeCode()
	{
		return  rand()% _vtask.size();
	}

	void Execute(int code)
	{
		_vtask[code]();
	}

private:
	std::vector<task> _vtask;
};	